package day0318.math;

import java.util.Arrays;
import java.util.Random;

/**
 * @Author Stringzhua
 * @Date 2024/3/19 10:00
 * description:Random()随机数
 * Ramdom(10)伪随机数
 */
public class Math_02 {
    public static void main(String[] args) {
        //创建了一个伪随机对象

        Random r1 = new Random();

        System.out.println(r1.nextInt());
        System.out.println(r1.nextInt(10));
        System.out.println(r1.nextDouble());
        System.out.println(r1.nextFloat());
        System.out.println(r1.nextBoolean());

        //创建一个数组,用随机数填充
        byte[] b = new byte[10];
        r1.nextBytes(b);
        System.out.println(Arrays.toString(b));
    }
}
